package edu.sctu.practice.class02.zengguangchuan.assign03.test1;

/**
 * Created by lenovo0 on 2015/10/29.
 */
public class Client {
    public static void main(String[] args) {

        System.out.println("圆的信息：");
        Circle circle = new Circle("green", 6);
        Client.displayGeometricObject(circle);

        System.out.println("************************");

        System.out.println("长方形的信息：");
        Rectangle rectangle = new Rectangle("black", 12, 23);
        Client.displayGeometricObject(rectangle);

        System.out.println("************************");

        System.out.println("长方形和圆的面积是否相等：");
        System.out.println(Client.equalArea(rectangle, circle));
    }

    static boolean equalArea(GeometricObject object1, GeometricObject object2) {

        return object1.findArea() == object2.findArea();
    }

    static void displayGeometricObject(GeometricObject object) {
        System.out.println("颜色：" + object.color);
        System.out.println("面积：" + object.findArea());
        System.out.println("周长：" + object.findPerimeter());
    }
}
